
import * as contains from './createTypes'
import axios from 'axios'


const getContents = (title, content) => ({
    type: contains.GET_CONTENT,
    title,
    content
})

export const  handleContent = (id) => {
    return dispatch => {
        axios.get('/api/detail.json?id=' + id).then(res=>{
            const result = res.data.data;
            dispatch(getContents(result.title, result.content))
        })
    }
}